package com.jlcindia.servlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
	@Override
protected void service(HttpServletRequest req, HttpServletResponse res)throws 
	ServletException,IOException{
		//1.Collecting the data
		String unm=req.getParameter("uname");
		String pwd=req.getParameter("pword");
		boolean er=false; 
                String page="login.jsp";
		if(unm==null||unm.trim().length()==0){
		req.setAttribute("uname","Name is required");
	er=true;
		}
		if(pwd==null||pwd.trim().length()==0){
			req.setAttribute("pword","Password is required");
er=true;
}
if(!er)
	page="hello.jsp";
req.getRequestDispatcher(page).forward(req, res);
}}